Component({
  data: {
    active: 0,
    list: [
      {
        icon: 'notes-o',
        text: '知识库',
        url: '/pages/mushroomList/mushroomList'
      },
      {
        icon: 'scan',
        text: '野生菌识别',
        url: '/pages/mushroom-identify/mushroom-identify'
      },
      {
        icon: 'newspaper-o',
        text: '资讯',
        url: '/pages/news/news'
      },
      {
        icon: 'shop-o',
        text: '商城',
        url: '/pages/shop/shop'
      }
    ]
  },

  methods: {
    onChange(event) {
      const index = event.detail;
      const url = this.data.list[index].url;
      wx.switchTab({
        url
      });
      this.setData({ active: index });
    }
  }
}); 